<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
    <script>
        // 复习对象 
        var obj = {
            msg:"daydayup",
            where:"wuhan",
            word:"天道酬勤"
        }
        console.log(obj.msg)
        console.log(obj['msg'])
        var key = "msg"
        

        obj.msg = "hello  world"
        console.log(obj[key])

        // 对象的属性名和 值简写  
        
        var name = "zkl"
        var age = 18
        var sex = "男性"
        // ES5
        var person = {
            name:name,
            age:age,
            sex:sex,
            say:function(){
                console.log(this.name + " - " + this.age)
            }
        }
        console.log(person)
        person.say()

        // 对象 属性名称简写
        // ES6
        // a.  如果对象键名 和 键值 对应的变量名相同 可以简写 
        // b.  函数也可以简写  (省略 function)
        var person = {
            name,  // name : name 
            age,
            sex,
            say(){
                console.log(this.name + " - " + this.age)
            }
        }
    </script>
</body>
</html>